package com.sds.sweng.swat.miplatform.ui.design.models.component;

import org.apache.commons.lang.StringUtils;

import com.sds.sweng.swat.miplatform.ui.design.models.area.sub.TableCellSubArea;

public class MTableLabel extends TableCellSubArea {

	private boolean required;

	public MTableLabel() {
		this(0, 0, 0, 1);
	}

	public MTableLabel(int col, int row, int width) {
		this(col, row, width, 1);
	}

	public MTableLabel(int col, int row, int width, int colspan) {
		super(col, row, width, colspan);
	}

	public MTableLabel clone() {
		MTableLabel clone = (MTableLabel) super.clone();
		clone.setRequired(isRequired());

		return clone;
	}

	public boolean isRequired() {
		return required;
	}

	public void setRequired(boolean required) {
		this.required = required;
	}

	@Override
	public boolean isEmpty() {
		if (StringUtils.isNotEmpty(getText()))
			return false;

		return true;
	}

	@Override
	public int getRemainWidth() {
		return 0;
	}

	public boolean isFixed() {
		return true;
	}

	@Override
	public int getRequireWidth() {
		return getWidth();
	}

}
